<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html>
<head>
	<title>发货单信息</title>
	<t:base type="jquery,easyui,tools,DatePicker"></t:base>
	<script type="text/javascript" src="plug-in/ckfinder/ckfinder.js"></script>
	<link rel="stylesheet" href="plug-in/uploadify/css/uploadify.css" type="text/css" />
	<script type="text/javascript" src="plug-in/uploadify/jquery.uploadify-3.1.min.js"></script>
	<script type="text/javascript">
        /**
         * 克隆
         **/
        function copyThisInvoice() {
            var deliverId = $('#deliverId').val();
            //tab名
            var dCode = $('#code').text();
            var tabName = "编辑" + dCode;
            $.ajax({
                type:"post",
                dataType:"json",
                data:{"id":deliverId},
                url:"cbsDelinerController.do?copyThisInvoice",
                success:function (data) {
                    var b = data.success;
                    if(b){
                        tip("克隆成功");
                        setTimeout("addOneTab('发货管理','cbsDelinerController.do?cbsDeliner');", 1000);
                        setTimeout("closetab('" + tabName + "')", 1000);
                    }
                }
            })
        }
        //编写自定义JS代码
        $(document).ready(function () {

            /*
            * 根据是否自提显示隐藏自提仓库
            * */
            var isZt=$('#isZt').text();
            //alert(isZt)
            if(isZt=='是'){
                $('#ztCk').show();
                // $('#shAddress').hide();
                // $('#shUser').hide();
            }else{
                $('#ztCk').hide();
                // $('#shAddress').show();
                // $('#shUser').show();
            }
        });


        function closeTap(){
            closetab('发货单详情');
        }

        function lookWl(){
            addOneTab('查看物流','http://www.kuaidi100.com/')
        }
	</script>
</head>
<body>
<div  style="margin-bottom:10px;">
	<input hidden="hidden" id="deliverId" value="${cbsDelinerPage.id}">
	<img style="margin-bottom:-7px" src="plug-in/login/images/dispatch bill.png">
	<span class="list-title" id="code">${cbsDelinerPage.code}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;

	<span style="font-size:13px;">状态：<span id="deliverStatus" class="color-red">${deliverStatus.typename}</span></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
	<input type="hidden" value="${cbsDelinerPage.status}" id="status"/>
	<input type="hidden" value="${cbsDelinerPage.logisticsSendTime}" id="logisticsSendTime"/>
	<input type="hidden" value="${slaType}" id="slaType"/>
	<span >已欠货时长:
			 <span class="color-red">${qhtime}</span>
	 </span>
	<div style="position: absolute; text-align: center; width: 100%; margin-top:-20px;">
		<c:if test="${type!=null && type!=''}">
			<c:if test="${type == 'look'}">
				<a class="easyui-linkbutton l-btn" onclick="copyThisInvoice()">克隆</a>
			</c:if>
		</c:if>

		<input type="hidden" id="id" value="${cbsDelinerPage.id}"/>
		<input type="hidden" id="sessionId" value="${pageContext.session.id}">
	</div>
</div>

<div class="subtitle">
	<p>关联信息</p>
	<table class="nobordertable noborder">
		<tbody>
		<tr>
			<td class="al_r" width="20%">
				<label>服务单号CR:</label>
			</td>
			<td width="30%">
				${cbsDelinerPage.crCode}
			</td>
			<td class="al_r" width="20%">
				<label>服务单类型:</label>
			</td>
			<td width="30%">
				${servicetype}
			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>SR:</label>
			</td>
			<td width="30%">
				${cbsDelinerPage.srCode}
			</td>
			<td class="al_r" width="20%">
				<label>SO:</label>
			</td>
			<td width="30%">
				${cbsDelinerPage.soCode}
			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>备件申请单号:</label>
			</td>
			<td width="30%">
				${cbsDelinerPage.spaceNumber}
			</td>
           <td class="al_r" width="20%">
                <label>备件申请人:</label>
            </td>
            <td width="30%">
                ${cbsDelinerPage.equipmentApplyId.createName}
            </td>
        </tr>
        <tr>
            <td class="al_r" width="20%">
                <label>备件申请备注:</label>
            </td>
            <td width="30%">
                ${cbsDelinerPage.equipmentApplyId.memo}
            </td>
			<td class="al_r" width="20%">
				<label>发货单类型:</label>
			</td>
			<td width="30%">
				<c:forEach items="${deliverTypeList}" var="tsType">
					<c:if test="${tsType.typecode==cbsDelinerPage.deliverType}">
						${tsType.typename}
					</c:if>
				</c:forEach>
			</td>
		</tr>
		</tbody>
	</table>
</div>
<div class="subtitle">
	<p>发货申请</p>
	<div id="updateEquipment">
		<c:forEach items="${deliverEquipmentList}" var="deliverEquipment">
			<div class="l-div deliverEquipment" id="deliverEquipments">
				<input type="checkbox" name="subcheck" class="equipmentCheck" value="${deliverEquipment.id}"/>
				<table class="nobordertable noborder" style="border: 1px;">
					<input name="deliverEquipmentId" class="deliverEquipmentId" type="hidden" value="${deliverEquipment.id}">
					<tbody>
					<tr>
						<td class="al_r" width="20%">
							<label>备件类型:</label>
						</td>
						<td width="30%">
								${deliverEquipment.typeDes}
						</td>
						<td class="al_r" width="20%">
							<label>备件号:</label>
						</td>
						<td width="30%">
								${deliverEquipment.item}
						</td>
					</tr>
					<tr>
						<td class="al_r" width="20%">
							<label>数量:</label>
						</td>
						<td width="30%">
								${deliverEquipment.total}
						</td>
						<td class="al_r" width="20%">
							<label>申请优先级:</label>
						</td>
						<td width="30%">
							<c:forEach items="${applyLayerList}" var="applyLayer">
								<c:if test="${applyLayer.typecode==deliverEquipment.applyLayer}">
									${applyLayer.typename}
								</c:if>
							</c:forEach>
						</td>
					</tr>
					<tr>
						<td class="al_r" width="20%">
							<label>是否返件:</label>
						</td>
						<td width="30%">
							<c:if test="${deliverEquipment.isReturn=='1'}">
								否
							</c:if>
							<c:if test="${deliverEquipment.isReturn=='2'}">
								是
							</c:if>
						</td>
						<td class="al_r" width="20%">
							<label>发货备件序列号:</label>
						</td>
						<td width="30%">
								${deliverEquipment.sn}
						</td>
					</tr>
					<tr>
						<td class="al_r" width="20%">
							<label>备件描述:</label>
						</td>
						<td width="30%">
							<textarea readonly="readonly" name="memo" style="width: 100%; height: 80px;" placeholder="${deliverEquipment.memo}"></textarea>
						</td>
						<td class="al_r" width="20%">
							<label>申请理由:</label>
						</td>
						<td width="30%">
								${deliverEquipment.applyReason}
						</td>
					</tr>
					<tr>
						<td class="al_r" width="20%">
							<label>物流发货序列号:</label>
						</td>
						<td width="30%">
						     ${deliverEquipment.deliverSn}
						</td>
						<td class="al_r" width="20%">
							<label>物流发货二维码:</label>
						</td>
						<td width="30%">
								${deliverEquipment.deliverErcode}
						</td>
					</tr>
					</tbody>
				</table>
			</div>
		</c:forEach>
	</div>
	<div style="margin-top:20px; width: 98%; margin: 10px auto;"><span style="font-weight: bold;">说明</span></div>
	<div class="line"></div>
	<table class="nobordertable noborder" style="border: none;">
		<tbody>
		<tr>
			<td class="al_r" width="20%">
				<label>发货说明:</label>
			</td>
			<td width="30%">
				<textarea readonly="readonly" style="width: 100%; height: 80px;" placeholder="${cbsDelinerPage.deliverDes}"></textarea>
			</td>
			<td class="al_r" width="20%">

			</td>
			<td width="30%">

			</td>
		</tr>
		</tbody>
	</table>
</div>
<div class="subtitle">
	<p>收货人信息</p>
	<table class="nobordertable noborder" style="border: none;">
		<tbody>
		<tr>
			<td class="al_r" width="20%">
				<label>是否自提:</label>
			</td>
			<td width="30%">
				 <span id="isZt">
					 <c:if test="${cbsDelinerPage.zt==1}">
						 是
					 </c:if>
					 <c:if test="${cbsDelinerPage.zt==2}">
						 否
					 </c:if>
				 </span>
			</td>
			<c:if test="${cbsDelinerPage.zt==1}">
				<td class="al_r" width="20%">
					<label>自提仓库:</label>
				</td>
				<td width="30%">
						${cbsDelinerPage.warehouseId.name}
				</td>
			</c:if>
		</tr>
		<tr id="shUser">
			<td class="al_r" width="20%">
				<label>姓名:</label>
			</td>
			<td width="30%">
				${cbsDelinerPage.userName}
			</td>
			<td class="al_r" width="20%">
				<label>电话:</label>
			</td>
			<td width="30%">
				${cbsDelinerPage.phone}
			</td>
		</tr>
		<tr id="shAddress">
			<td class="al_r" width="20%">
				<label>收货地址:</label>
			</td>
			<td width="30%">
				<c:if test="${cbsDelinerPage.sheng !=null}">
					${cbsDelinerPage.sheng.territoryName}
				</c:if>
				<c:if test="${cbsDelinerPage.shi !=null}">
					${cbsDelinerPage.shi.territoryName}
				</c:if>
				<c:if test="${cbsDelinerPage.address !=null}">
					${cbsDelinerPage.address}
				</c:if>

			</td>
			<td class="al_r" width="20%">
				<label>影院名称:</label>
			</td>
			<td width="30%">
				${cbsDelinerPage.cinemaName}
			</td>
		</tr>
		<tr id="ztCk" hidden="hidden">
			<td class="al_r"><label>自提仓库:</label></td>
			<td colspan="3">
				${cbsDelinerPage.warehouseId.sheng.territoryName}
				&nbsp;&nbsp;
				<span>${cbsDelinerPage.warehouseId.name}</span>
			</td>
		</tr>
		</tbody>
	</table>
</div>
<div class="subtitle">
	<p>物流</p>
	<table class="nobordertable noborder" style="border: none;" id="Wltable">
		<tbody>
		<tr>
			<td class="al_r" width="20%">
				<label>发货物流:</label>
			</td>
			<td width="30%">
				${cbsDelinerPage.deliverLogistics}
			</td>
			<td class="al_r" width="20%">
				<label>联系人:</label>
			</td>
			<td width="30%">
				${zyContacts.name}
			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>电话:</label>
			</td>
			<td width="30%">
				${zyContacts.cellphone1}
			</td>
			<td class="al_r" width="20%">
				<label>邮箱:</label>
			</td>
			<td width="30%">
				${zyContacts.email}
			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>发货SLA:</label>
			</td>
			<td width="30%">
				${fhSLA.typename}
			</td>
			<td class="al_r" width="20%">
				<label>库位:</label>
			</td>
			<td width="30%">
				${kuwei.typename}
			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>仓库:</label>
			</td>
			<td width="30%">
				${cbsDelinerPage.deliverWarehouseId.name}
			</td>
			<td class="al_r" width="20%">
				<label>物流单号:</label>
			</td>
			<td width="30%">
				${deliverEquipmentList[0].logisticsNumber}&nbsp;&nbsp;<span  class="color-blue" onclick="lookWl()">[查看物流]</span>
			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>预计到货时间:</label>
			</td>
			<td width="30%">
				<fmt:formatDate value="${cbsDelinerPage.expectTime}" type="date" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>

			</td>
			<td class="al_r" width="20%">
				<label>物流发货附件:</label>
			</td>
			<td width="30%">
					<c:if test="${zyFileLogEntityListSend!=null}">
						<c:forEach items="${zyFileLogEntityListSend}" var="zyFileLogEntityList">
                        <span onclick="addOneTab('预览','cbsServiceController.do?openViewFile&fileid=${zyFileLogEntityList.id}')"
							  style="color: blue">${zyFileLogEntityList.oldFileName}</span>
							<span class="color-blue"><a
									href="fileUploadController.do?downLoadFile&fileLogId=${zyFileLogEntityList.id}">[下载]</a></span>
						</c:forEach>
					</c:if>
			</td>
		</tr>
		<tr>
			<td class="al_r" valign="top"><label>物流发货备注:</label></td>
			<td colspan="3">
				<textarea readonly="readonly" style="width:100%; height: 60px;" placeholder="${cbsDelinerPage.logisticsMemo}"></textarea>
			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>物流提货地址:</label>
			</td>
			<td width="30%">
				<c:if test="${cbsDelinerPage.thSheng!=null}">
					${cbsDelinerPage.thSheng.territoryName}&emsp;
				</c:if>
				<c:if test="${cbsDelinerPage.thCity!=null}">
					${cbsDelinerPage.thCity.territoryName}&emsp;
				</c:if>
				<c:choose>
					<c:when test="${cbsDelinerPage.thAddress!= null && cbsDelinerPage.thAddress!=''}">
						${cbsDelinerPage.thAddress}
					</c:when>

					<c:otherwise>
						无
					</c:otherwise>
				</c:choose>
			</td>
		</tr>
		</tbody>
	</table>
	<table class="nobordertable noborder" style="border: none;">
		<tbody>
		<tr>
			<td class="al_r" width="20%">
				<label>返件物流:</label>
			</td>
			<td width="30%">
				${cbsDelinerPage.returnLogistics}
			</td>
			<td class="al_r" width="20%">
				<label>联系人:</label>
			</td>
			<td width="30%">
				${returnContacts.name}
			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>电话:</label>
			</td>
			<td width="30%">
				${returnContacts.cellphone1}
			</td>
			<td class="al_r" width="20%">
				<label>邮箱:</label>
			</td>
			<td width="30%">
				${returnContacts.email}
			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>是否ETA延迟:</label>
			</td>
			<td width="30%">
				<label >
					<c:if test="${cbsDelinerPage.etaStandard == '1'}">
						是
					</c:if>
					<c:if test="${cbsDelinerPage.etaStandard == '2'}">
						否
					</c:if>
				</label>
			</td>
			<td class="al_r" width="20%">
				<label>ETA延迟原因:</label>
			</td>
			<td width="30%">
				<label >${cbsDelinerPage.etaQunqualified}</label>
			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>ETA延迟备注:</label>
			</td>
			<td width="30%">
				<label >${cbsDelinerPage.etaNotQualifiedMemo}</label>

			</td>
		</tr>
		</tbody>
	</table>
</div>
<div class="subtitle">
	<p>签收</p>
	<table class="nobordertable noborder" style="border: none;" id="wlSign">
		<tbody>
		<tr>
			<td class="al_r" width="20%">
				<label>签收方式:</label>
			</td>
			<td width="30%">
				${cbsDelinerPage.signMethod}
			</td>
			<td class="al_r" width="20%">
				<label>签收时间:</label>
			</td>
			<td width="30%">
				<fmt:formatDate value="${cbsDelinerPage.getTime}" type="date" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate>

			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>物流单照片:</label>
			</td>
			<td width="30%">
				<c:if test="${zyFileLogEntityListSign!=null}">
					<c:forEach items="${zyFileLogEntityListSign}" var="zyFileLogEntityList">
						<span onclick="addOneTab('预览','cbsServiceController.do?openViewFile&fileid=${zyFileLogEntityList.id}')" style="color: blue">${zyFileLogEntityList.oldFileName}</span>
						<span class="color-blue"><a
								href="fileUploadController.do?downLoadFile&fileLogId=${zyFileLogEntityList.id}">[下载]</a></span>
					</c:forEach>
				</c:if>
			</td>
			<td class="al_r" width="20%">
				<label>签收备注:</label>
			</td>
			<td width="30%">
				${cbsDelinerPage.signMemo}
			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
			<label>是否SLA达标:</label>
		</td>
			<td width="30%">
				<label >
					<c:if test="${cbsDelinerPage.isStandard == '1'}">
						是
					</c:if>
					<c:if test="${cbsDelinerPage.isStandard == '2'}">
						否
					</c:if>
				</label>

			</td>
			<td class="al_r" width="20%">
				<label>是否签收延迟:</label>
			</td>
			<td width="30%">
				<label >
					<c:if test="${cbsDelinerPage.signStandard == '1'}">
						否
					</c:if>
					<c:if test="${cbsDelinerPage.signStandard == '2'}">
						是
					</c:if>
				</label>

			</td>
		</tr>
		<tr>
			<td class="al_r" width="20%">
				<label>签收延迟原因:</label>
			</td>
			<td width="30%">
			${cbsDelinerPage.notQualified}
			</td>

			<td class="al_r" width="20%">
				<label>签收延迟备注:</label>
			</td>
			<td width="30%">
				${cbsDelinerPage.notQualifiedMemo}
			</td>
		</tr>
		</tbody>
	</table>
</div>
<div class="subtitle">
	<p>日志</p>
	<table class="ftable">
		<tbody>
		<tr>
			<th>操作人</th>
			<th>时间</th>
			<th>描述</th>
		</tr>
		<c:forEach items="${logList}" var="log">
			<tr>
				<td>${log.createName}</td>
				<td><fmt:formatDate value="${log.createDate}" type="date" pattern="yyyy-MM-dd HH:mm:ss"></fmt:formatDate></td>
				<td>${log.description}</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
</div>
</body>
<script src = "webpage/com/zybk/com.deli/cbsDeliner.js"></script>